<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js_object</title>
    <style>
        *{margin: 0; padding: 0;}
        div{width: 100px;height: 100px;}
        #div1{background-color: red}
        #div2{background-color: blue}
        #div3{background-color: green}

    </style>
    <script>
        /**文档就绪函数*/
        window.onload = function() {
            /**动态绑定函数（添加事件监听器函数）**/
            document.getElementById("div1").addEventListener("click", function () {
                this.style.width = 200 + 'px';
                this.style.height = 200 + 'px';
            });
            document.getElementById("div1").onmouseleave= function () {
                this.style.width = 100 + 'px';
                this.style.height = 100 + 'px';
            };
        }
    </script>
</head>
<body>
<div id="div1"></div>
<div id="div2"></div>
<div id="div3"></div>
</body>
</html>